package com.wt.dao;

import com.wt.pojo.Member;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface MemberMapper {
    @Delete({
        "delete from brand_admin_member",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into brand_admin_member (id, account, ",
        "username, password, salt, ",
        "sex, phone, identity, ",
        "avatar, moneys, ",
        "status, reason, login_count, ",
        "last_login_time, last_login_ip, ",
        "reg_time, reg_ip, ",
        "email, qq, openid, ",
        "sina, hobby, fid)",
        "values (#{id,jdbcType=INTEGER}, #{account,jdbcType=CHAR}, ",
        "#{username,jdbcType=CHAR}, #{password,jdbcType=CHAR}, #{salt,jdbcType=CHAR}, ",
        "#{sex,jdbcType=TINYINT}, #{phone,jdbcType=CHAR}, #{identity,jdbcType=CHAR}, ",
        "#{avatar,jdbcType=VARCHAR}, #{moneys,jdbcType=DECIMAL}, ",
        "#{status,jdbcType=CHAR}, #{reason,jdbcType=CHAR}, #{loginCount,jdbcType=SMALLINT}, ",
        "#{lastLoginTime,jdbcType=INTEGER}, #{lastLoginIp,jdbcType=VARCHAR}, ",
        "#{regTime,jdbcType=INTEGER}, #{regIp,jdbcType=VARCHAR}, ",
        "#{email,jdbcType=VARCHAR}, #{qq,jdbcType=CHAR}, #{openid,jdbcType=CHAR}, ",
        "#{sina,jdbcType=CHAR}, #{hobby,jdbcType=VARCHAR}, #{fid,jdbcType=INTEGER})"
    })
    int insert(Member record);

    int insertSelective(Member record);

    @Select({
        "select",
        "id, account, username, password, salt, sex, phone, identity, avatar, moneys, ",
        "status, reason, login_count, last_login_time, last_login_ip, reg_time, reg_ip, ",
        "email, qq, openid, sina, hobby, fid",
        "from brand_admin_member",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Member selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Member record);

    @Update({
        "update brand_admin_member",
        "set account = #{account,jdbcType=CHAR},",
          "username = #{username,jdbcType=CHAR},",
          "password = #{password,jdbcType=CHAR},",
          "salt = #{salt,jdbcType=CHAR},",
          "sex = #{sex,jdbcType=TINYINT},",
          "phone = #{phone,jdbcType=CHAR},",
          "identity = #{identity,jdbcType=CHAR},",
          "avatar = #{avatar,jdbcType=VARCHAR},",
          "moneys = #{moneys,jdbcType=DECIMAL},",
          "status = #{status,jdbcType=CHAR},",
          "reason = #{reason,jdbcType=CHAR},",
          "login_count = #{loginCount,jdbcType=SMALLINT},",
          "last_login_time = #{lastLoginTime,jdbcType=INTEGER},",
          "last_login_ip = #{lastLoginIp,jdbcType=VARCHAR},",
          "reg_time = #{regTime,jdbcType=INTEGER},",
          "reg_ip = #{regIp,jdbcType=VARCHAR},",
          "email = #{email,jdbcType=VARCHAR},",
          "qq = #{qq,jdbcType=CHAR},",
          "openid = #{openid,jdbcType=CHAR},",
          "sina = #{sina,jdbcType=CHAR},",
          "hobby = #{hobby,jdbcType=VARCHAR},",
          "fid = #{fid,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Member record);
    

    
}